
<meta charset="utf-8">
<div class="box" id="biz_cloudMember_conatainer">
	<div class="box-header with-border">
		<form id="searchForm" role="form" class="form-inline">
			<div class="form-group">
				<label>姓名</label> <input name="name" v-model="searchForm.userName"
					type="text" placeholder="" class="form-control">
			</div>
			<div class="form-group">
				<label>账号</label> <input name="account" v-model="searchForm.account"
					type="text" placeholder="" class="form-control">
			</div>

			<div class="form-group">
				<label>类型</label> <select id="userType" name="userType"
					v-model="searchForm.userType" class=" form-control">
					<option value="1">开发人员</option>
					<option value="2">测试人员</option>
					<option value="3">项目经理</option>
					<option value="4">管理人员</option>
				</select>
			</div>
			<div class="form-group">
				<label>等级</label> <input type="number" min="1" max="7"
					v-model="searchForm.positionLevel" id="positionLevel"
					name="positionLevel" class="form-control" required>
			</div>

			<button type="button" class="btn btn-info pull-right m-t-n-xs"
				v-on:click="search">
				<strong>查询</strong>
			</button>
		</form>
	</div>
	<div class="box-body">
		<div class="row">
			<div class="col-md-12">
				<div class="btn-group " id="cloudMemberTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="add">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加成员
					</button>

					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="setPwd">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 设置密码
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="resetPwd">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 修改密码
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="setUserLogo">
						<i class="glyphicon glyphicon-pencil" aria-hidden="true"></i> 上传头像
					</button>

					<button type="button" v-kperms="{perm:''}" class="btn btn-default"
						v-on:click="deletex">
						<i class="glyphicon glyphicon-trash" aria-hidden="true"></i> 删除成员
					</button>
				</div>
				<table id="cloudMemberBootstrapTable" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
</div>
<script>
new Vue({  
	  el: '#biz_cloudMember_conatainer',
	  data:{
		  searchForm:{
			  userName: null,
			  userType: null,
			  positionLevel: null
		  },
		  bus:new Vue()
	  },
	  mounted:function(){
		  var _this=this;
		  _this.initTable();
	  },
    methods: {
  	  initTable:function(){
  		var _this=this;
 
  		var columns=[
  					{checkbox:true},
  					{field:'user_name',title:'名称',width:160,sortable:true},
					{field:'user_type',title:'类型',width:60,formatter:_this.formatType},
					{field:'position_level',title:'等级',width:100}];
  		  
  		  
  		  var url="/pmp/service/ma/pmpCloudMember/loadPmpCloudMemberDataSet";
    		zfesBstable.laodTable($("#cloudMemberBootstrapTable"),$("#searchForm"),$("#cloudMemberTableToolbar"),url,columns,this.searchForm);
  	  },
  	  search:function(){
  		  zfesBstable.reload($("#cloudMemberBootstrapTable")); 
  	  },
  	  refresh:function(){
  		  zfesBstable.refresh($("#cloudMemberBootstrapTable"));
  	  },
  	  add:function(){
  		  var　_this=this;
  		 var url="/views/cloudMember/cloudMember.add.html";
  		 zfesLayerEditDg.open(url,{},"创建成员",660,function(){_this.refresh();});
  		 
  	  },
  	  setPwd:function(){
  		  if(zfesBstable.isOneRow($("#cloudMemberBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#cloudMemberBootstrapTable"));
  			  var url="/views/cloudMember/cloudMember.setPwd.html";
  			  zfesLayerEditDg.open(url,{"userId":id},"设置密码",600,function(){_this.refresh();}); 
  		 }
  	  },
  	 resetPwd:function(){
		  if(zfesBstable.isOneRow($("#cloudMemberBootstrapTable"))){
			  var　_this=this;
			  var id=zfesBstable.getRowId($("#cloudMemberBootstrapTable"));
			  var url="/views/cloudMember/cloudMember.resetPwd.html";
			  zfesLayerEditDg.open(url,"修改密码",600,function(){_this.refresh();}); 
		 }
	  },
	  setUserLogo:function(){
  		  if(zfesBstable.isOneRow($("#cloudMemberBootstrapTable"))){
  			  var　_this=this;
  			  var id=zfesBstable.getRowId($("#cloudMemberBootstrapTable"));
  			  var url="/views/cloudMember/cloudMember.setUserLogo.html";
  			  zfesLayerEditDg.open(url,{"id":id},"上传头像",600,function(){_this.refresh();}); 
  		 }
  	  },
  	  deletex:function(){
  			if(zfesBstable.isSelectedRow($("#cloudMemberBootstrapTable"))){
  				  var　_this=this;
  				    var id=zfesBstable.getRowId($("#cloudMemberBootstrapTable"));
  					//var ids=zfesBstable.getRowIds($("#cloudMemberBootstrapTable"));
  					 alertSwal.confirm("删除","是否删除该成员",function(){
  						    var ajaxUrl = "/pmp/service/ma/pmpCloudMember/deletePmpCloudMember";
  							zfesAjax.ajaxTodo(ajaxUrl, { "id" : id}, function(data) {
  								alertSwal.successText(data.message);
  								_this.refresh();
  							}); 
  				});
  			}
  				
  	  },
  	  formatType:function(value, row, index){
  		if("1"==value){return '[开发人员]';}else if("2"==value){return '[测试人员]';}else if("3"==value){return '[项目经理]';}else{return '[管理人员]';}
  	}
   	
   }

});
</script>


